package com.edais.dao;

import com.edais.domain.Invitation;
import com.edais.persistence.InvitationMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Repository

public class InvitationDao {
	@Autowired
	private InvitationMapper invitationMapper;

	/**
	 * 根据用户Id获取我的邀请码
	 */
	public String getMyInvitationCdById(String userId) throws Exception {
		return this.invitationMapper.getMyInvitationCdById(userId);
	}
	
	/**
	 * 根据邀请码获取邀请人数
	 */
	public String getInvitationCountByCd(String invitationCd) throws Exception {
		return this.invitationMapper.getInvitationCountByCd(invitationCd);
	}
	
	/**
	 * 根据邀请码获取邀请总记录数
	 */
	public String getInvitationTotalNumByCd(String invitationCd) throws Exception {
		return this.invitationMapper.getInvitationTotalNumByCd(invitationCd);
	}
	
	/**
	 * 根据邀请码获取邀请列表
	 */
	public List<Invitation> getInvitationListByCd(String invitationCd, 
			Integer rowBegin, Integer rowEnd) throws Exception {
		return this.invitationMapper.getInvitationListByCd(invitationCd, rowBegin, rowEnd);
	}
	
	/**
	 * 获取活动文案
	 */
	public Map<String, String> getActivityRecord(String userId) throws Exception {
		return this.invitationMapper.getActivityRecord(userId);
	}

	/**
	 * 获取用户的头像信息
	 */
	public Map<String, Object> getInvitationById(String userId) throws Exception {
		return this.invitationMapper.getInvitationById(userId);
	}

}
